import iAlert from './i-alert.vue'
import Vue from 'vue'

iAlert.newInstance = properties => {
  const props = properties || {}
  const Instance = new Vue({
    data: props,
    render(h) {
      return h(iAlert, {
        props: props
      })
    }
  })
  const component = Instance.$mount()
  document.body.appendChild(component.$el)
  const alert = Instance.$children[0]
  return {
    add(noticeProps) {
      alert.add(noticeProps)
    },
    remove(noticeProps) {
      alert.remove(noticeProps)
    }
  }
}

export default iAlert